package com.mango.leet.code.week2.game377;

import java.util.Arrays;

/**
 * https://leetcode.cn/contest/weekly-contest-377/problems/minimum-number-game/
 * @author mango
 * @since 2023/12/24
 */
public class LC100148 {
    public static int[] numberGame(int[] nums) {
        Arrays.sort(nums);
        int len = nums.length;
        int[] result = new int[len];
        for (int i = 0; i < len/2; i++) {
            result[i*2] = nums[i*2+1];
            result[i*2+1] = nums[i*2];
        }
        return result;
    }
    public static void main(String[] args) {
        int[] nums = {5,4,3,2};
        System.out.println(Arrays.toString(numberGame(nums)));
    }
}
